package sicau.carManager.exception;

import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpStatus;

/**
 * @Author ITcz
 * @Data 2021-02-06 - 17:15
 */
@Setter
@Getter
public class ApiException extends RuntimeException{

    private String message;

    private int code = HttpStatus.INTERNAL_SERVER_ERROR.value();

    public ApiException(String message) {
        super(message);
        this.message = message;
    }

    public ApiException(String message, Throwable throwable) {
        super(message, throwable);
        this.message = message;
    }

    public ApiException(String message, int code) {
        super(message);
        this.message = message;
        this.code = code;
    }

    public ApiException(String message, int code, Throwable throwable) {
        super(message, throwable);
        this.code = code;
        this.message = message;
    }
}
